<?php
include("db/connect.php");
include("funcsubstr.php");
$sql="select * from cart,product where cart.pro_id=product.pro_id and orderid='0'";
$query=mysql_query($sql);
?>

    <div id="cartdiv">
    <form id="form1">
    <div>

	<table border="1" class="display" id="tb_shopping">
	<thead style="color:black !important;font-size:16px;">
	<tr>
	<th>รหัสสินค้า</th>
	<th>ชื่อสินค้า</th>
	<th>ราคา</th>
	<th>จำนวน</th>
	<th>รวม</th>
	<th>ลบ</th>
	</tr>
	</thead>
	<tbody style="color:black !important;font-size:16px;">
	<?php 
	$countRow=0;
	$sum=0;
	while($result2=mysql_fetch_array($query)){
	$countRow++;
	$sum+=$result2["pro_price"]*$result2["qty"];
	
	 ?>
	
	<tr>
	<td><?php echo $result2["pro_id"];?></td>
	<td><?php echo $result2["pro_name"].color($result2["pro_color"]);?></td>
	<td><?php echo $result2["pro_price"];?></td>
	<td><?php echo $result2["qty"];?></td>
	<td><?php echo number_format( $result2["pro_price"]*$result2["qty"])?></td>
	<td><a href="#" onclick="Javascript:dltcart(<?php echo $result2["pro_id"]?>,'per');">ลบ</a></td>
	</tr>
	 <?php }?>
	 	</tbody>
		<tfoot style="color:black !important;background:#BBDEFB;font-size:16px;">
	 <tr>
	 <td colspan="4">รวมทั้งหมด</td>
	 <td><?php echo number_format( $sum)?></td>
	 <td>บาท</td>
	 </tr>
	 	</tfoot>
	</table>
    </div>
    </form>
	<div>
	
	</div>
	</div>
	
	<script>
	$(function(){
	  	var oTable = $('#tb_shopping').dataTable({
          "bJQueryUI": true,
          "sPaginationType": "full_numbers"
      });
	});
	</script>